package interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import controller.WordAction;
import lombok.Data;

@Data
public class WordInterceptor extends AbstractInterceptor {
    private String title;
    private String context;
    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        //获取action
        WordAction wordAction= (WordAction) invocation.getAction();
        if (wordAction.getTitle().indexOf("妈的")!=-1&&wordAction.getContext().indexOf("妈的")!=-1){
            return "dirty";
        }else {
            return invocation.invoke();
        }
    }
}
